﻿using System;
using System.ComponentModel.DataAnnotations;
using System.Data;
using TidyBlog.Data.Mapping;

namespace TidyBlog.Entity
{
    /// <summary>
    /// 用户实体类
    /// </summary>
    [Table(Name = "TidyBlog_User")]
    public class User
    {
        /// <summary>
        /// 用户编号
        /// </summary>
        [Column(IsPrimaryKey = true, IsDbGenerated = true)]
        public int UserId { get; set; }
        /// <summary>
        /// 用户名
        /// </summary>
        [Column(DataType = DbType.AnsiString, Length = 20, IsUpdateIgnore = true), DisplayFormat(ConvertEmptyStringToNull = false)]
        public string UserName { get; set; }
        /// <summary>
        /// 密码
        /// </summary>
        [Column(DataType = DbType.AnsiStringFixedLength, Length = 40), DisplayFormat(ConvertEmptyStringToNull = false)]
        public string Password { get; set; }
        /// <summary>
        /// 昵称
        /// </summary>
        [Column(DataType = DbType.String, Length = 20), DisplayFormat(ConvertEmptyStringToNull = false)]
        public string Nickname { get; set; }
        /// <summary>
        /// Email
        /// </summary>
        [Column(DataType = DbType.String, Length = 80), DisplayFormat(ConvertEmptyStringToNull = false)]
        public string Email { get; set; }
        /// <summary>
        /// QQ号码
        /// </summary>
        [Column(DataType = DbType.AnsiString, Length = 20), DisplayFormat(ConvertEmptyStringToNull = false)]
        public string QQ { get; set; }
        /// <summary>
        /// 个人主页
        /// </summary>
        [Column(DataType = DbType.String, Length = 80), DisplayFormat(ConvertEmptyStringToNull = false)]
        public string HomePage { get; set; }
        /// <summary>
        /// 注册时间
        /// </summary>
        [Column(IsUpdateIgnore = true)]
        public DateTime RegTime { get; set; }
        /// <summary>
        /// 最后活动IP
        /// </summary>
        [Column(DataType = DbType.AnsiString, Length = 15, IsUpdateIgnore = true, IsDbGenerated = true), DisplayFormat(ConvertEmptyStringToNull = false)]
        public string LastIP { get; set; }
        /// <summary>
        /// 最后活动时间
        /// </summary>
        [Column(IsUpdateIgnore = true)]
        public DateTime LastActivity { get; set; }


        public User()
        {
            
        }
    }
}
